/*
 * Copyright 2025 The JA-SIG Collaborative. All rights reserved.
 * distributed with this file and available online at
 */
package com.lap.auth.domain.api;

import com.lap.framework.common.ddd.AggregateRoot;
import java.time.LocalDateTime;
import lombok.Getter;

/**
 * 接口访问日志领域。
 *
 * @author Shuisheng Lao(劳水生)
 * @version 0.0.1
 */
@Getter
public class ApiViewLog extends AggregateRoot {

  private final Integer id;
  private final Integer userId;
  private final String userName;
  private final String fullName;
  private final String targetServer;
  private final String protocol;
  private final String requestPath;
  private final String requestMethod;
  private final String browser;
  private final String clientOs;
  private final String requestIp;
  private final String requestAddress;
  private final String requestBody;
  private final LocalDateTime requestTime;
  private final LocalDateTime responseTime;
  private final String responseData;
  private final Long times;

  public ApiViewLog(
      Integer id,
      Integer userId,
      String userName,
      String fullName,
      String targetServer,
      String protocol,
      String requestPath,
      String requestMethod,
      String browser,
      String clientOs,
      String requestIp,
      String requestAddress,
      String requestBody,
      LocalDateTime requestTime,
      LocalDateTime responseTime,
      String responseData,
      Long times) {
    this.id = id;
    this.userId = userId;
    this.userName = userName;
    this.fullName = fullName;
    this.targetServer = targetServer;
    this.protocol = protocol;
    this.requestPath = requestPath;
    this.requestMethod = requestMethod;
    this.browser = browser;
    this.clientOs = clientOs;
    this.requestIp = requestIp;
    this.requestAddress = requestAddress;
    this.requestBody = requestBody;
    this.requestTime = requestTime;
    this.responseTime = responseTime;
    this.responseData = responseData;
    this.times = times;
  }

  public boolean isNew() {
    return (id == null);
  }
}
